<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { useUserPinia } from '@/store//modules/user';
import { login } from "@/api/login";
import { getUserInfo } from "@/api/user";

const useUser = useUserPinia();

onLaunch(() => {
  console.log("App Launch");
  // 导航栏高度
  const { statusBarHeight } = uni.getSystemInfoSync();
  if (statusBarHeight) {
    useUser.updateStatusBarHeight(statusBarHeight)
  }
});
onShow(() => {
    // 登录
    uni.login({
    provider: 'weixin',
    success: ({ code }) => {
      login({ code }).then((res) => {
        uni.setStorageSync('token', res.token);
      })
    }
  })
  console.log("App Show");
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">
@import "uview-plus/index.scss";
@import "./static/styles/index.scss";
</style>
